<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="keywords" content="">
		<meta name="description" content="">
		<meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1.0, user-scalable=no" />	
		<title>在线问答</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/font-awesome.css" />
		<link rel="stylesheet" href="css/public.css" />
	</head>
	<body>
		<div class="quiz-true">
			<div class="quiz-topx">
				<div class="row margin-bottom-10  vote-list-row quiz-border-show">
				    <div class="col-xs-4 lei-name lei-name-two">
				    	<span>姓</span><span>名</span>
				    </div>
				    <div class="col-xs-8 lei-input quiz-border-hide">
				    	<input type="text" id="username"/>
				    </div>
			    </div>
			    <div class="row margin-bottom-10  vote-list-row quiz-border-show">
				    <div class="col-xs-4 lei-name lei-name-four">
				    	<span>联</span><span>系</span><span>电</span><span>话</span>
				    </div>
				    <div class="col-xs-8 lei-input quiz-border-hide">
				    	<input type="text" id="phone"/>
				    </div>
			    </div>
			    <div class="tj-btn row tk-btn-row vote-list-row padding-top-5">
			    	<div class="col-xs-12 text-center">
			    		<a href="#" class="tj">提交</a>
			    	</div>
			    	<div class="tk-true">
			    		提交成功！请关注5月26日比赛现场的互动环节，届时将公布中奖名单。
			    	</div>
			    </div>
			</div>
		</div>
	</body>
</html>
<script type="text/javascript" src="js/cookie.js" ></script>
<script type="text/javascript">
	if (!getCookie('openid')) {
		window.location.href=window.location.origin+'/welcome/to_oauth/quiz';
	}
</script>

<script type="text/javascript" src="js/jquery-2.2.3.min.js" ></script>
<script type="text/javascript">
	$(function(){
		$('.tj').click(function(){
			var username    = $("#username").val();
			var phone       = $("#phone").val();

			if (username.trim()==''|| username.length >20) {
				alert('用户名2~20个字符');
				return false;
			}
			reg =  /^1[3|4|5|8|7][0-9]\d{8}$/;
			if(!reg.test(phone)){
				alert('手机号码格式错误，请重新输入');
				return false;
			}

			var requestData = {"username":username,'phone':phone};
			$.post('/welcome/save_quiz',requestData,function(data){
				if (data.status=='ok') {
//					alert('提交成功！请关注5月26日比赛现场的互动环节，届时将公布中奖名单。');
					$(".tk-true").css('display','block');
				}else if (data.status=='update_ok') {
//					alert('提交成功！请关注5月26日比赛现场的互动环节，届时将公布中奖名单。');
					$(".tk-true").css('display','block');
				}else if(data.status=='exist'){
//					$(".tk-true").html("您已经提交，无需重复提交").css('display','block');
				}else{
					$(".tk-true").html("提交失败！").css('display','block');
				}

			},'json')
			
			
		})

		$.get('/welcome/quiz',function(data){
			(data.username)?$("#username").val(data.username):'';
			(data.phone)?$("#phone").val(data.phone):'';
		},'json')
		
	})
	
</script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="js/jssdk.js"></script>
<script type="text/javascript">jssdk('共筑疫情防护墙，同圆生态家园梦。','共筑疫情防护墙，同圆生态家园梦。','http://forestry.xuanzhen-tech.com/public/quiz.html','http://forestry.xuanzhen-tech.com/public/img/question.jpg');</script>
